package handler

import (
	"github.com/gin-gonic/gin"
	"net/http"
	"yk/api/request"
	"yk/consts"
	"yk/internal/queue"
)

func Admin(c *gin.Context) {
	var req request.Admin
	if err := c.ShouldBind(&req); err != nil {
		c.JSON(http.StatusOK, gin.H{
			"code": 10000,
			"msg":  "参数验证",
			"data": err.Error(),
		})
		return
	}

	queue.PublishPub(consts.ADMIN_EXCHANGE, req.Message)

	c.JSON(http.StatusOK, gin.H{
		"code": 200,
		"msg":  "发送成功",
		"data": true,
	})

}
